<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@include file="/resource/common/taglib.jspf"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>${SESSION_COMPANY}-系统用户管理</title>
<%@include file="/resource/common/jquery.jspf"%>
<%@include file="/resource/common/commonCss.jspf"%>
<%@include file="/resource/common/kindeditor.jspf"%>
<%@include file="/resource/common/bootstrap.jspf"%>
<%@include file="/resource/common/validate.jspf"%>
<%@include file="/resource/common/showLoading.jspf"%>
<%@include file="/resource/common/tips.jspf"%>
<script type="text/javascript" src="${ctxStatic }/js/system/asyncDoSubmitForm.js"></script>
<script type="text/javascript">
	var PATH = "${ctx}";
	//初始在线编辑器
    ShowEditorHtml("#description", "word_count");
	var result = 0;
	var validateForm;
	$(document).ready(function() {
		$("body").showLoading();
		validateForm = $("#inputForm").validate({
			rules : {
				username : {
					required : true,
					remote : {
						url : "sysUserIsExists.do", //后台处理程序
						type : "post", //数据发送方式
						dataType : "json", //接受数据格式   
						data : { //要传递的数据
							username : function() {
								return $("#username").val();
							}
						}
					}
				},
				password : {
					required : true,
					minlength : 6,
					maxlength : 18
				},
				confirm_password : {
					required : true,
					minlength : 6,
					maxlength : 18,
					equalTo : "#password"
				},
				contact : {
					required : true,
					minlength : 2,
					maxlength : 25
				},
				tel : {
					required : true,
					minlength : 11,
					maxlength : 11
				},
				email : {
					required : true,
					email : true
				},
			},
			messages : {
				username : {
					required : "请输入帐号",
					minlength : "帐号长度不能小于4个字符",
					remote : "帐号已经被注册，请重新换一个."
				},
				password : {
					required : "请输入6-18位的密码(数字和字母或者一般符号组合)",
					minlength : "密码长度不能小于6个字符",
					maxlength : "密码长度不能大于18个字符"
				},
				confirm_password : {
					required : "请输入6-18位的密码(数字和字母或者一般符号组合)",
					minlength : "密码长度不能小于6个字符",
					maxlength : "密码长度不能大于18个字符",
					equalTo : "二次输入的密码不正确"
				}
			},
			errorElement : "em",
			errorClass : "validate_error",
			submitHandler: function(form) { //通过之后回调
				//save();
			},
			invalidHandler: function(form, validator) {
				return false;
			}
		});
		
		$("body").hideLoading();
	});
	
</script>
</head>
<body>
	<div id="body-wrapper">
		<div id="main-content">
			<div class="content-box-content">
				<div class="tab-content default-tab" id="tab1">
					<fieldset>
						<input type="hidden" id="asyncResult" name="asyncResult" value="-1" /> 
						<input type="hidden" id="asyncResultData" name="asyncResultData" value="-1" /> 
						<input type="hidden" id="asyncResultError" name="asyncResultError" value="-1" /> 
						<form:form id="inputForm" name="form1" method="post" class="form-horizontal" action="">
							<div class="row">
								<div class="col-md-6 col-sm-6 col-xs-6" >
									<div class="form-group">
										<input type="hidden" id="uid" name="uid" value="${user.uid}">
										<input type="hidden" id="channelId" name="channelId" value="${user.channelId}">
										<label class="col-md-2 col-sm-2 col-xs-2 control-label">帐号：<span style="color: red">*</span></label>
										<div class="col-md-10 col-sm-10 col-xs-10">
											<c:choose>
												<c:when test="${empty user.username }"><input type="text" class="form-control input-sm" id="username" name="username" value="${ user.username }" placeholder="帐号" /></c:when>
												<c:otherwise><input type="text" class="form-control input-sm" id="username" name="username" value="${ user.username }" placeholder="帐号" readonly="readonly"/></c:otherwise>
											</c:choose>
										</div>
									</div>
									<div class="form-group">
										<label class="col-md-2 col-sm-2 col-xs-2 control-label">手机：<span style="color: red">*</span></label>
										<div class="col-md-10 col-sm-10 col-xs-10">
											<input type="text" class="form-control input-sm" id="tel" name="tel" value="${ user.tel }" placeholder="手机"/>
										</div>
									</div>
									<c:if test="${empty user.uid }">
										<div class="form-group">
											<label class="col-md-2 col-sm-2 col-xs-2 control-label">密码：<span style="color: red">*</span></label>
											<div class="col-md-10 col-sm-10 col-xs-10">
												<input type="password" class="form-control input-sm" id="password" name="password" value="" placeholder="密码"/>
											</div>
										</div>
									</c:if>
									<div class="form-group">
										<label class="col-md-2 col-sm-2 col-xs-2 control-label">状态：<span style="color: red">*</span></label>
										<div class="col-md-10 col-sm-10 col-xs-10">
											 <select id="enable" name="enable" class="form-control input-sm">
												<option value="1" <c:if test="${user.enable==1 }">selected="selected"</c:if>>启用</ption>
												<option value="0" <c:if test="${user.enable==0 }">selected="selected"</c:if>>禁用</option>
											</select>
										</div>
									</div>
								</div>
								<div class="col-md-6 col-sm-6 col-xs-6" >
									<div class="form-group">
										<label class="col-md-2 col-sm-2 col-xs-2 control-label">联系人：<span style="color: red">*</span></label>
										<div class="col-md-10 col-sm-10 col-xs-10">
											<input type="text" class="form-control input-sm" id="contact" name="contact" value="${ user.contact }" placeholder="联系人"/>
										</div>
									</div>
									<div class="form-group">
										<label class="col-md-2 col-sm-2 col-xs-2 control-label">Email：<span style="color: red">*</span></label>
										<div class="col-md-10 col-sm-10 col-xs-10">
											<input type="text" class="form-control input-sm" id="email" name="email" value="${ user.email }" placeholder="email"/>
										</div>
									</div>
									<c:if test="${empty user.uid }">
										<div class="form-group">
											<label class="col-md-2 col-sm-2 col-xs-2 control-label">确认密码：<span style="color: red">*</span></label>
											<div class="col-md-10 col-sm-10 col-xs-10">
												<input type="password" class="form-control input-sm" id="confirm_password" name="confirm_password" value="" placeholder="验证密码"/>
											</div>
										</div>
									</c:if>
									<c:if test="${ user.channelId >0}">
										<div class="form-group">
											<label class="col-md-2 col-sm-2 col-xs-2 control-label">所属频道</label>
											<div class="col-md-10 col-sm-10 col-xs-10">
												 <input type="text" class="form-control input-sm" readonly="readonly" id="time" name="time" value="${user.channelName }" placeholder="所属频道"/>
											</div>
										</div>
									</c:if>
								</div>
							</div>
							<div class="row">
								<div class="col-md-12 col-sm-12 col-xs-12" >
									<div class="form-group">
										<label class="col-md-1 col-sm-1 col-xs-1 control-label">描述：</label>
										<div class="col-md-11 col-sm-11 col-xs-11">
											 <textarea id="description" name="description" style="width:100%; height: 150px; visibility: hidden;">${ user.description }</textarea>
										您当前输入了 <span class="word_count">0</span>
										个文字。（字数统计包含纯文本、IMG、EMBED，不包含换行符，IMG和EMBED算一个文字。
										</div>
									</div>
								</div>
							</div>
						</form:form>
					</fieldset>
				</div>
			</div>
		</div>
	</div>
</body>
</body>
</html>